
print.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <_strcpy>:
#include <stdlib.h>
#include <string.h>
#include <assert.h>

char *_strcpy(char *dest, const char *src)
{
   0:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
   4:	910003fd 	mov	x29, sp
   8:	f9000fa0 	str	x0, [x29, #24] ; dest
   c:	f9000ba1 	str	x1, [x29, #16] ; src
	assert( (dest != NULL) && (src != NULL));
  10:	f9400fa0 	ldr	x0, [x29, #24]      ; x0 = dest
  14:	f100001f 	cmp	x0, #0x0            ; dest ?= NULL
  18:	54000080 	b.eq	28 <_strcpy+0x28>  // b.none
  1c:	f9400ba0 	ldr	x0, [x29, #16]         ; x0 = src
  20:	f100001f 	cmp	x0, #0x0
  24:	54000141 	b.ne	4c <_strcpy+0x4c>  // b.any
  28:	90000000 	adrp	x0, 0 <_strcpy>
  2c:	91000002 	add	x2, x0, #0x0 ; x2 = parameter
  30:	90000000 	adrp	x0, 0 <_strcpy>
  34:	91000001 	add	x1, x0, #0x0 ; x1 = parameter
  38:	90000000 	adrp	x0, 0 <_strcpy>
  3c:	91000000 	add	x0, x0, #0x0 ; x0 = parameter
  40:	aa0203e3 	mov	x3, x2       ; x3 = parameter
  44:	52800102 	mov	w2, #0x8                   	// #8
  48:	94000000 	bl	0 <__assert_fail>
	char *adr;
	
	adr = dest;
  4c:	f9400fa0 	ldr	x0, [x29, #24] ; dest
  50:	f90017a0 	str	x0, [x29, #40] ; adr
	while ( (*dest++ = *src++) != '\0');
  54:	d503201f 	nop
  58:	f9400fa0 	ldr	x0, [x29, #24] ; x0 = dest
  5c:	91000401 	add	x1, x0, #0x1   ; x1 = dest+1
  60:	f9000fa1 	str	x1, [x29, #24] ; save dest+1
  64:	f9400ba1 	ldr	x1, [x29, #16] ; x1 = src
  68:	91000422 	add	x2, x1, #0x1   ; x2 = src+1
  6c:	f9000ba2 	str	x2, [x29, #16] ; save src+1
  70:	39400021 	ldrb	w1, [x1]   ; w1 = *src
  74:	39000001 	strb	w1, [x0]   ; *dest = *src
  78:	39400000 	ldrb	w0, [x0]   ; w0 = *dest
  7c:	7100001f 	cmp	w0, #0x0
  80:	54fffec1 	b.ne	58 <_strcpy+0x58>  // b.any
	
	return adr;
  84:	f94017a0 	ldr	x0, [x29, #40] ; adr
}
  88:	a8c37bfd 	ldp	x29, x30, [sp], #48
  8c:	d65f03c0 	ret

0000000000000090 <main>:

int main()
{
  90:	a9bc7bfd 	stp	x29, x30, [sp, #-64]!
  94:	910003fd 	mov	x29, sp
  98:	f9000bf3 	str	x19, [sp, #16]
	char name[5] = "asdf";
  9c:	90000000 	adrp	x0, 0 <_strcpy>
  a0:	91000001 	add	x1, x0, #0x0 ; x1 = parameter
  a4:	910083a0 	add	x0, x29, #0x20 ; name
  a8:	b9400022 	ldr	w2, [x1]       ; w2 = parameter
  ac:	b9000002 	str	w2, [x0]       ; name = parameter
  b0:	b8401021 	ldur	w1, [x1, #1] ; w1 = parameter + 1
  b4:	b8001001 	stur	w1, [x0, #1] ; name+1 = parameter+1
	char *p1 = "name";
  b8:	90000000 	adrp	x0, 0 <_strcpy>
  bc:	91000000 	add	x0, x0, #0x0 ; x0 = parameter
  c0:	f9001fa0 	str	x0, [x29, #56] ; p1 = name
	char *p2;
	int i;
	

	p2 = (char *)malloc(20);
  c4:	d2800280 	mov	x0, #0x14                  	// #20
  c8:	94000000 	bl	0 <malloc>
  cc:	f90017a0 	str	x0, [x29, #40] ; p2 = malloc
	memset(p2, 0, 20);
  d0:	d2800282 	mov	x2, #0x14                  	// #20
  d4:	52800001 	mov	w1, #0x0                   	// #0
  d8:	f94017a0 	ldr	x0, [x29, #40]              ; p2
  dc:	94000000 	bl	0 <memset>
	
	p2 = "xiaozhixiaozhixiaozhixiaozhixiaozhixiaozhi";
  e0:	90000000 	adrp	x0, 0 <_strcpy>
  e4:	91000000 	add	x0, x0, #0x0 ; parameter
  e8:	f90017a0 	str	x0, [x29, #40] ; p2
	//*p2++ = 'b';
	//*p2++ = 'c';
	
	//					4	4		4		5
	printf(" == %s %d %d %d %d\n", p1, strlen(p1), sizeof(p1), strlen(name), sizeof(name));	
  ec:	f9401fa0 	ldr	x0, [x29, #56] ; x0 = p1
  f0:	94000000 	bl	0 <strlen>
  f4:	aa0003f3 	mov	x19, x0 ; x19 = strlen(p1)
  f8:	910083a0 	add	x0, x29, #0x20 ; x0 = x29 + 0x20 = name
  fc:	94000000 	bl	0 <strlen>
 100:	aa0003e1 	mov	x1, x0  ; x1 = strlen(name)
 104:	90000000 	adrp	x0, 0 <_strcpy>
 108:	91000000 	add	x0, x0, #0x0 ; parameter
 10c:	d28000a5 	mov	x5, #0x5                   	// #5
 110:	aa0103e4 	mov	x4, x1                      ; x4 = strlen(name)
 114:	d2800103 	mov	x3, #0x8                   	// #8
 118:	aa1303e2 	mov	x2, x19                     ; x2 = strlen(p1)
 11c:	f9401fa1 	ldr	x1, [x29, #56] ; p1
 120:	94000000 	bl	0 <printf>
	printf(" == %s %d %d\n", p2, strlen(p2), sizeof(p2));	
 124:	f94017a0 	ldr	x0, [x29, #40]                  ; p2 
 128:	94000000 	bl	0 <strlen>
 12c:	aa0003e1 	mov	x1, x0  ; x1 = strlen(p2)
 130:	90000000 	adrp	x0, 0 <_strcpy>
 134:	91000000 	add	x0, x0, #0x0 ; parameter
 138:	d2800103 	mov	x3, #0x8                   	// #8
 13c:	aa0103e2 	mov	x2, x1
 140:	f94017a1 	ldr	x1, [x29, #40]
 144:	94000000 	bl	0 <printf>
	
	//while(*p2++ = *p1++);
	//while((*p2++ = *p1++) != 4);
	for (i = 0; i < 3; i++)
 148:	b90037bf 	str	wzr, [x29, #52] ; i
 14c:	1400000b 	b	178 <main+0xe8>
		name[i] = *p1++;
 150:	f9401fa0 	ldr	x0, [x29, #56] ; x0 =  p1
 154:	91000401 	add	x1, x0, #0x1   ; x1 = p1+1
 158:	f9001fa1 	str	x1, [x29, #56] ; save p1+1
 15c:	39400002 	ldrb	w2, [x0]   ; w2 = *p1
 160:	b98037a0 	ldrsw	x0, [x29, #52] ; i
 164:	910083a1 	add	x1, x29, #0x20     ; x1 = name
 168:	38206822 	strb	w2, [x1, x0]   ; name[i] = *p1++
	for (i = 0; i < 3; i++)
 16c:	b94037a0 	ldr	w0, [x29, #52] ; i
 170:	11000400 	add	w0, w0, #0x1   ; i+1
 174:	b90037a0 	str	w0, [x29, #52] ; save i+1
 178:	b94037a0 	ldr	w0, [x29, #52] ; w0 = i
 17c:	7100081f 	cmp	w0, #0x2
 180:	54fffe8d 	b.le	150 <main+0xc0>
	//*p2 = '\0';
	printf("%s\n", name);
 184:	910083a0 	add	x0, x29, #0x20 ; name
 188:	94000000 	bl	0 <puts>
 18c:	52800000 	mov	w0, #0x0                   	// #0
}
 190:	f9400bf3 	ldr	x19, [sp, #16]
 194:	a8c47bfd 	ldp	x29, x30, [sp], #64
 198:	d65f03c0 	ret
